<template>
  <div>
    <h1> 这个页面是 2号页面 </h1>
    {{points}} <br/>
    <input type='button' @click='increase' value='点击增加1'/><br/>
    <router-link :to="{name: 'ShowCounter1'}">
          计时页面1
    </router-link>
  </div>
</template>

<script>

// 它这里没有将vuex的状态管理器注册到main.js的组件中，而是在各个组件中一个个导入，我感觉这样还不如陈艳男老师的写法
import store from '@/vuex/store'
import { INCREASE } from '@/vuex/mutation_types'
export default {
  computed: {
    points() {
      return store.getters.get_points
    }
  },
  store,
  mounted() {
  },
  methods: {
    increase() {
      store.commit(INCREASE, store.getters.get_points + 1)
    }
  }
}
</script>
